xen: Option to allow per-device vector maps for MSI IRQs
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 26 Jul 2011 17:37:16 +0000 (18:37 +0100)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 26 Jul 2011 17:37:16 +0000 (18:37 +0100)
Add a vector-map to pci_dev, and add an option to point MSI-related
IRQs to the vector-map of the device.

This prevents irqs from the same device from being assigned
the same vector on different pcpus.  This is required for systems
using an AMD IOMMU, since the intremap tables on AMD only look at
vector, and not destination ID.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/irq.c
xen/include/xen/pci.h

index f02ab0c9cffa2862b03724a108cf4bad72d03118..dbd597862216ead7a9f076fbb91c879dcea9eacf 100644 (file)
@@ -32,6 +32,9 @@ unsigned int __read_mostly nr_irqs_gsi = 16;
 unsigned int __read_mostly nr_irqs;
 integer_param("nr_irqs", nr_irqs);
 
+bool_t __read_mostly opt_irq_perdev_vector_map = 0;
+boolean_param("irq-perdev-vector-map", opt_irq_perdev_vector_map);
+
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
@@ -1654,6 +1657,9 @@ int map_domain_pirq(
             dprintk(XENLOG_G_ERR, "dom%d: irq %d in use\n",
               d->domain_id, irq);
         desc->handler = &pci_msi_type;
+        if ( opt_irq_perdev_vector_map
+             && !desc->chip_data->used_vectors )
+            desc->chip_data->used_vectors = &pdev->info.used_vectors;
         set_domain_irq_pirq(d, irq, info);
         setup_msi_irq(pdev, msi_desc, irq);
         spin_unlock_irqrestore(&desc->lock, flags);
index 6313c388a335ac53986ea1cc0092443815b99649..25bd415d2a0d1835d11621fbd59e8a97ef4e88f4 100644 (file)
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 #include <xen/spinlock.h>
+#include <xen/irq.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
@@ -38,6 +39,7 @@ struct pci_dev_info {
         u8 bus;
         u8 devfn;
     } physfn;
+   vmask_t used_vectors; 
 };
 
 struct pci_dev {